home *** CD-ROM | disk | FTP | other *** search
/ Apple WWDC 1996 / WWDC96_1996 (CD).toast / Technology Materials / MacOS 8 Resources / Developer Tools / Mac OS 8 Interfaces & Libraries / Interfaces / CIncludes / DriverFamilyMatching.h < prev    next >
C/C++ Source or Header  |  1996-05-01  |  10KB  |  317 lines

  1. /*
  2.      File:        DriverFamilyMatching.h
  3.  
  4.      Contains:    xxx put contents here xxx
  5.  
  6.      Version:    Technology:    xxx put the technology version here xxx
  7.                  Release:    Universal Interfaces 3.0d3 on Copland DR1
  8.  
  9.      Copyright:    © 1984-1996 by Apple Computer, Inc.  All rights reserved.
  10.  
  11.      Bugs?:        If you find a problem with this file, send the file and version
  12.                  information (from above) and the problem description to:
  13.  
  14.                      Internet:    apple.bugs@applelink.apple.com
  15.                      AppleLink:    APPLE.BUGS
  16.  
  17. */
  18. #ifndef __DRIVERFAMILYMATCHING__
  19. #define __DRIVERFAMILYMATCHING__
  20.  
  21. #ifndef __TYPES__
  22. #include <Types.h>
  23. #endif
  24. #ifndef __NAMEREGISTRY__
  25. #include <NameRegistry.h>
  26. #endif
  27. #ifndef __TEXTOBJECTS__
  28. #include <TextObjects.h>
  29. #endif
  30. #ifndef __CODEFRAGMENTS__
  31. #include <CodeFragments.h>
  32. #endif
  33.  
  34. #ifdef __cplusplus
  35. extern "C" {
  36. #endif
  37.  
  38. #if PRAGMA_IMPORT_SUPPORTED
  39. #pragma import on
  40. #endif
  41.  
  42. #if PRAGMA_ALIGN_SUPPORTED
  43. #pragma options align=mac68k
  44. #endif
  45.  
  46. /* Please refer to Devices.i for DriverDescriptor definition for Marconi */
  47. #if FOR_SYSTEM7_AND_SYSTEM8_PREEMPTIVE
  48. /*
  49. #########################################################
  50.  Descriptor for Drivers and NDRVs
  51. #########################################################
  52. */
  53. /* Driver Typing Information Used to Match Drivers With Devices */
  54. struct DriverType {
  55.     Str31                             nameInfoStr;                /* Driver Name/Info String*/
  56.     NumVersion                         version;                    /* Driver Version Number*/
  57. };
  58. typedef struct DriverType DriverType;
  59.  
  60. typedef DriverType *DriverTypePtr;
  61. /* OS Runtime Information Used to Setup and Maintain a Driver's Runtime Environment */
  62. typedef OptionBits RuntimeOptions;
  63.  
  64. enum {
  65.     kDriverIsLoadedUponDiscovery = 0x00000001,                    /* auto-load driver when discovered*/
  66.     kDriverIsOpenedUponLoad        = 0x00000002,                    /* auto-open driver when loaded*/
  67.     kDriverIsUnderExpertControl    = 0x00000004,                    /* I/O expert handles loads/opens*/
  68.     kDriverIsConcurrent            = 0x00000008,                    /* supports concurrent requests*/
  69.     kDriverQueuesIOPB            = 0x00000010,                    /* device manager doesn't queue IOPB*/
  70.     kDriverIsLoadedAtBoot        = 0x00000020,                    /* Driver is loaded at the boot time */
  71.     kDriverIsForVirtualDevice    = 0x00000040                    /* Driver is for a virtual Device */
  72. };
  73.  
  74. struct DriverOSRuntime {
  75.     RuntimeOptions                     driverRuntime;                /* Options for OS Runtime*/
  76.     Str31                             driverName;                    /* Driver's name to the OS*/
  77.     UInt32                             driverDescReserved[8];        /* Reserved area*/
  78. };
  79. typedef struct DriverOSRuntime DriverOSRuntime;
  80.  
  81. typedef DriverOSRuntime *DriverOSRuntimePtr;
  82. /* OS Service Information Used To Declare What APIs a Driver Supports */
  83. typedef UInt32 ServiceCount;
  84. struct DriverServiceInfo {
  85.     OSType                             serviceCategory;            /* Service Category Name*/
  86.     OSType                             serviceType;                /* Type within Category*/
  87.     NumVersion                         serviceVersion;                /* Version of service*/
  88. };
  89. typedef struct DriverServiceInfo DriverServiceInfo;
  90.  
  91. typedef DriverServiceInfo *DriverServiceInfoPtr;
  92. struct DriverOSService {
  93.     ServiceCount                     nServices;                    /* Number of Services Supported*/
  94.     DriverServiceInfo                 service[1];                    /* The List of Services (at least one)*/
  95. };
  96. typedef struct DriverOSService DriverOSService;
  97.  
  98. typedef DriverOSService *DriverOSServicePtr;
  99. /* Categories */
  100.  
  101. enum {
  102.     kServiceCategoryDisplay        = 'disp',                        /* Display Manager*/
  103.     kServiceCategoryOpenTransport = 'otan',                        /* Open Transport*/
  104.     kServiceCategoryBlockStorage = 'blok',                        /* Block Storage*/
  105.     kServiceCategoryNdrvDriver    = 'ndrv',                        /* Generic Native Driver*/
  106.     kServiceCategoryScsiSIM        = 'scsi',                        /* SCSI */
  107.     kServiceCategoryFileManager    = 'file',                        /* File Manager */
  108.     kServiceCategoryIDE            = 'ide-',                        /* ide */
  109.     kServiceCategoryADB            = 'adb-',                        /* adb */
  110.     kServiceCategoryPCI            = 'pci-',                        /* pci bus */
  111.                                                                 /* Nu Bus */
  112.     kServiceCategoryPCMCIA        = 'pcmc',                        /* PCMCIA */
  113.     kServiceCategoryDFM            = 'dfm-',                        /* DFM */
  114.     kServiceCategoryMotherBoard    = 'mrbd',                        /* mother Board */
  115.     kServiceCategoryKeyboard    = 'kybd',                        /* Keyboard */
  116.     kServiceCategoryPointing    = 'poit',                        /* Pointing */
  117.     kServiceCategoryRTC            = 'rtc-',                        /* RTC */
  118.     kServiceCategoryNVRAM        = 'nram',                        /* NVRAM */
  119.     kServiceCategorySound        = 'sond',                        /* Sound (1/3/96 MCS) */
  120.     kServiceCategoryPowerMgt    = 'pgmt',                        /* Power Management */
  121.     kServiceCategoryGeneric        = 'genr'                        /* Generic Service Category to receive general Events */
  122. };
  123.  
  124. /* Ndrv ServiceCategory Types */
  125.  
  126. enum {
  127.     kNdrvTypeIsGeneric            = 'genr',                        /* generic*/
  128.     kNdrvTypeIsVideo            = 'vido',                        /* video*/
  129.     kNdrvTypeIsBlockStorage        = 'blok',                        /* block storage*/
  130.     kNdrvTypeIsNetworking        = 'netw',                        /* networking*/
  131.     kNdrvTypeIsSerial            = 'serl',                        /* serial*/
  132.     kNdrvTypeIsSound            = 'sond',                        /* sound*/
  133.     kNdrvTypeIsBusBridge        = 'brdg'
  134. };
  135.  
  136. typedef UInt32 DriverDescVersion;
  137. /*    The Driver Description */
  138.  
  139. enum {
  140.     kInitialDriverDescriptor    = 0,
  141.     kVersionOneDriverDescriptor    = 1
  142. };
  143.  
  144.  
  145. enum {
  146.     kTheDescriptionSignature    = 'mtej',
  147.     kDriverDescriptionSignature    = 'pdes'
  148. };
  149.  
  150. struct DriverDescription {
  151.     OSType                             driverDescSignature;        /* Signature field of this structure*/
  152.     DriverDescVersion                 driverDescVersion;            /* Version of this data structure*/
  153.     DriverType                         driverType;                    /* Type of Driver*/
  154.     DriverOSRuntime                 driverOSRuntimeInfo;        /* OS Runtime Requirements of Driver*/
  155.     DriverOSService                 driverServices;                /* Apple Service API Membership*/
  156. };
  157. typedef struct DriverDescription DriverDescription;
  158.  
  159. typedef DriverDescription *DriverDescriptionPtr;
  160. #endif
  161. #if FOR_SYSTEM8_PREEMPTIVE
  162. /*
  163. ################################################
  164.  Family Matching Data Structure
  165. ################################################
  166. */
  167. /*    The Family Type */
  168.  
  169. enum {
  170.     kFamilyIsHighLevel            = 0,                            /* High Level Family */
  171.     kFamilyIsLowLevel            = 1                                /* Low Level Family  */
  172. };
  173.  
  174. typedef UInt32 FamilyLevel;
  175. /* Family Typing Information Used to Match Families With plug-ins and Devices */
  176. struct FamilyType {
  177.     FamilyLevel                     familyLevel;                /* Kind of Family */
  178.     OSType                             familyName;                    /* Family Name */
  179.     NumVersion                         version;                    /* Family Version Number*/
  180.     OSType                             reserved;                    /* Used by Mother Board Expert */
  181. };
  182. typedef struct FamilyType FamilyType;
  183.  
  184. typedef FamilyType *FamilyTypePtr;
  185.  
  186. enum {
  187.     kFamilyIsLoadedAtBoot        = 0x00000001,                    /* Family is loaded at the boot time */
  188.     kFamilyIsLoadedUponDiscovery = 0x00000002,                    /* auto-load Family when discovered */
  189.     kFamilyIsStartedAtBoot        = 0x00000004                    /* Family is initialized at the Boot */
  190. };
  191.  
  192. typedef UInt32 FamilyOSRunTimeOptions;
  193. struct FamilyOSRunTime {
  194.     FamilyOSRunTimeOptions             familyRuntime;                /* Options for OS Runtime*/
  195.     Str31                             familyName;                    /* Family's name to the OS*/
  196.     UInt32                             familyDescReserved[8];        /* Reserved area*/
  197. };
  198. typedef struct FamilyOSRunTime FamilyOSRunTime;
  199.  
  200. typedef FamilyOSRunTime *FamilyOSRunTimePtr;
  201. /*    The Family Description */
  202.  
  203. enum {
  204.     kFamilyDescriptionSignature    = 'fdes'
  205. };
  206.  
  207. typedef UInt32 FamilyDescVersion;
  208.  
  209. enum {
  210.     kInitialFamilyDescriptor    = 0,
  211.     kMotherBoardDescriptor        = 1
  212. };
  213.  
  214. typedef UInt32 DependencyCount;
  215. struct MatchingAndDependencyInfo {
  216.     union {
  217.         Str31                             deviceName;                /* the device name to match */
  218.         OSType                             dependency;                /* Dependency List */
  219.     }                                 u;
  220. };
  221. typedef struct MatchingAndDependencyInfo MatchingAndDependencyInfo;
  222.  
  223. typedef MatchingAndDependencyInfo *MatchingAndDependencyInfoPtr;
  224. struct FamilyMatchingAndDependency {
  225.     DependencyCount                 nrElements;                    /* Number of elements in the Array */
  226.     MatchingAndDependencyInfo         matchingInfo[1];
  227. };
  228. typedef struct FamilyMatchingAndDependency FamilyMatchingAndDependency;
  229.  
  230. typedef FamilyMatchingAndDependency *FamilyMatchingAndDependencyPtr;
  231. struct FamilyDescription {
  232.     OSType                             familyDescSignature;        /* Signature field of this structure*/
  233.     FamilyDescVersion                 familyDescVersion;            /* Version of this data structure*/
  234.     FamilyType                         familyType;                    /* Type of Driver*/
  235.     FamilyOSRunTime                 familyOSRuntime;            /* OS Runtime Requirements of Family */
  236.     FamilyMatchingAndDependency     familymatchingAndDependency; /* Family Dependency Info */
  237.  
  238. };
  239. typedef struct FamilyDescription FamilyDescription;
  240.  
  241. typedef FamilyDescription *FamilyDescriptionPtr;
  242. /*
  243. ##############################################
  244.  Definition of "driver-ptr" property
  245. ##############################################
  246. */
  247. struct DriverPtrProperty {
  248.     LogicalAddress                     pluginLocator;
  249.     UInt32                             length;
  250. };
  251. typedef struct DriverPtrProperty DriverPtrProperty;
  252.  
  253. typedef DriverPtrProperty *DriverPtrPropertyPtr;
  254. /*
  255. ##############################################
  256.  Status Definition for DFMReportInitStatus
  257. ##############################################
  258. */
  259.  
  260. enum {
  261.     kInitStatusOK                = 0,
  262.     kInitStatusNotOK            = 1
  263. };
  264.  
  265. /*
  266. ##############################################
  267.  Declare the pluginLoadID
  268. ##############################################
  269. */
  270. typedef struct OpaquePluginLoadID* PluginLoadID;
  271. /*
  272. ##############################################
  273.  Function Prototypes
  274. ##############################################
  275. */
  276. extern UInt32 DFMReportInitStatus(OSType serviceCategory, UInt32 status);
  277.  
  278. extern OSStatus DFMRemovePlugIns(RegEntryRef *device, OSType serviceCategory, UInt32 nrPlugIns, LogicalAddress *pluginLocatorsInUse);
  279.  
  280. extern OSStatus DFMLoadPlugin(LogicalAddress pluginLocator, ConstStr63Param pluginName, PluginLoadID *pluginLoadID, LogicalAddress *main, LogicalAddress *pluginDT, TextObject optErrMsg);
  281.  
  282. extern OSStatus DFMUnloadPlugin(PluginLoadID *pluginLoadID);
  283.  
  284. extern OSStatus DFMGetCFragConnectID(PluginLoadID *pluginLoadID, CFragConnectionID *connectionID);
  285.  
  286. /*
  287. ##############################################
  288.  Well known properties in the Name Registry
  289. ##############################################
  290. */
  291.  
  292. #define kPropertyName                    "name"
  293. #define kPropertyCompatible                "compatible"
  294. #define    kPropertyDriverPtr                "driver-ptr"
  295. #define kPropertyDriverDesc                "driver-description"
  296. #define kPropertyReg                    "reg"
  297. #define kPropertyAAPLAddress            "AAPL,address"
  298. #define kPropertyMatching                "matching"
  299.  
  300. /* CPassThru */
  301. #endif
  302.  
  303. #if PRAGMA_ALIGN_SUPPORTED
  304. #pragma options align=reset
  305. #endif
  306.  
  307. #if PRAGMA_IMPORT_SUPPORTED
  308. #pragma import off
  309. #endif
  310.  
  311. #ifdef __cplusplus
  312. }
  313. #endif
  314.  
  315. #endif /* __DRIVERFAMILYMATCHING__ */
  316.  
  317.